package com.example.fee.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.util.Date;

@TableName(value = "sys_fee")
public class SysFee extends Model<SysFee> {

    //主鍵信息
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    //用戶id信息
    @TableField(value = "user_id")
    private String userId;

    //用戶費用
    @TableField(value = "fee")
    private int fee;

    //创建时间
    @TableField(value = "create_time")
    private Date createTime;

    //更新时间
    @TableField(value = "update_time")
    private Date updateTime;

    public void recalculateFields() {
        if (this.createTime == null) {
            this.createTime = new Date();
        }
        this.updateTime = new Date();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public int getFee() {
        return fee;
    }

    public void setFee(int fee) {
        this.fee = fee;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }


    public SysFee() {
    }

    public SysFee(Long id, String userId, int fee) {
        this.id = id;
        this.userId = userId;
        this.fee = fee;
    }
}
